<template>
	<view class="content">
		<view class="title" style="display: flex;flex-direction: column;align-items: center;justify-content: center;">
		<text style="font-size:40rpx;">子组价B</text>
		</view>
		<view class="b-box" style="padding-left: 10px;">
			compA组件传进来的值:
			<text class="intent-text-box">{{result}}</text>
		</view>
		<view class="b-box" style="margin: 10px; display: flex;">
			<text>回传值：</text>
			<input type="text" v-model="callbackValue" style="color: yellow;background-color: darkgrey;"/>
			<button @click="sendOuside()" size="mini">回传</button>
		</view>
	</view>
</template>
<script>
	export default {
		name:"compB",
		data() {
			return {
				callbackValue:"",
				result:""
			};
		},
		created(){
			uni.$on('SendIntent',(msg)=>{
				 console.log("SendIntent---compB get Intent " +msg);
				 this.result=msg
			})
		},
		methods:{
			sendOuside(){
				console.log("sendOuside---");
				this.$emit('callBackFun',this.callbackValue);
				
			}
		}
	}
</script>
<style>
.content{
	background-color: aquamarine;
	padding-top: 10px;
	margin: 20px;
	height: 150px;
}
.title{
	margin-top: 10px;
}
.b-box{
	margin-top: 15px;
	margin-bottom: 15px;
}
</style>